package com.wnnight.wys.entity.car;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wnnight.wys.entity.lanlord.Landlord;
import com.wnnight.wys.groupInterface.AddGroup;
import com.wnnight.wys.groupInterface.AlterGroup;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @ClassName: Car
 * @Description: 车辆实体类
 * @author: CHX42
 * @date: 2022/8/27-16:54
 * @version: v1.0
 */
@Setter
@Getter
@ToString
@TableName(value = "wys_car")
@JsonIgnoreProperties(ignoreUnknown = true)
@ExcelIgnoreUnannotated //忽略所有未注释的字段
public class Car {

    @TableId(type = IdType.AUTO)
    @NotNull(message = "ID为空", groups = {AlterGroup.class})
    private Integer id;
    @TableField("car_num")
    @NotBlank(message = "车牌不能为空", groups = {AddGroup.class})
    @Pattern(regexp = "^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4,5}[A-Z0-9挂学警港澳]{1}$",
            message = "不正确的车牌号",
            groups = {AddGroup.class, AlterGroup.class})
    @ExcelProperty(value = "车牌", index = 0)
    private String carNum;//车牌
    @TableField("landlord_id")
    private Integer landlordId;
    @TableField("reg_time")
    @ExcelProperty(value = "登记时间", index = 4)
    private String regTime; //登记时间
    @TableField("status")
    @ExcelProperty(value = "车辆状态", index = 1)
    private String status;  //车辆状态
    @TableField("phone")
    @NotBlank(message = "车主电话", groups = {AddGroup.class})
    @ExcelProperty(value = "电话号码", index = 3)
    private String phone;   //手机号
    @TableField("owner")
    @NotBlank(message = "车主姓名", groups = {AddGroup.class})
    @ExcelProperty(value = "用户名", index = 2)
    private String owner;   //所有者
    @TableField("end_time")
    @ExcelProperty(value = "到期时间", index = 5)
    private String endTime;  //到期时间
    @TableField("is_delete")
    private String isDelete;    //是否删除
    @TableField(exist = false)
    private Landlord landlord;

    @NotNull(message = "续费时长为空", groups = {AddGroup.class})
    @TableField(exist = false)
    private Integer xfTime;  //续费时长（季度）


    @TableField(exist = false)
    @ExcelProperty(value = "用户名", index = 2)
    private String name;
    @TableField(exist = false)
    private String gender;
    @TableField(exist = false)
    private String place;
    @TableField(exist = false)
    private String parkNum;
}
